package org.timeticker.impl;

import org.timeticker.WorkType;
import org.timeticker.WorkTypeList;

/**
 * Work types list implementation
 *
 * @author Ivan Latysh
 * @version 0.1
 * @since 10-Aug-2007 : 4:05:19 PM
 */
public class WorkTypeListImpl extends AbstractObjectList<WorkType> implements WorkTypeList {

  /**
   * Create a new work type list
   */
  public WorkTypeListImpl() {
  }

  /**
   * Return WorkType by i'ts code or null if work type not found
   *
   * @param key work type key
   * @return work type or <tt>null</tt>
   */
  public WorkType get(String key) {
    if (null==key) return null;
    for (WorkType wt: objects) {
      if (key.equals(wt.getCode())) return wt;
    }
    return null;
  }
}
